Communication system, communication apparatus, control method therefor, and computer program

ABSTRACT

In a communication system, one of a plurality of communication apparatuses that acts as a host controls data transmission and the other communication apparatuses that act as devices perform data transmission under control of the host over a predetermined communication interface. The communication apparatuses have both host and device roles, and are configured to exchange the host and device roles by using a predetermined communication protocol are connected to the predetermined communication interface. A first apparatus acts as a host and a second apparatus as a device. The second apparatus transmits information concerning the second apparatus to the first apparatus. The first apparatus compares the transmitted information with information concerning the first apparatus to determine whether or not to switch the host and device roles according to a predetermined criterion. In response to an affirmative determination, the host and device roles are switched by using the predetermined communication protocol.

CROSS REFERENCES TO RELATED APPLICATIONS

The present invention contains subject matter related to Japanese PatentApplication JP 2007-167617 filed in the Japanese Patent Office on Jun.26, 2007, the entire contents of which are incorporated herein byreference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a communication system, a communicationapparatus, a control method therefor, and a computer program in which aplurality of devices perform data transmission over a predeterminedcommunication interface, and in particular to a communication system, acommunication apparatus, a control method therefor, and a computerprogram in which one of the devices acts as a “host” and controls datatransmission over the communication interface while the other devicesacts as “devices” and perform data transmission over the communicationinterface under control of the host.

More specifically, the present invention relates to a communicationsystem, a communication apparatus, a control method therefor, and acomputer program in which dual-role communication devices having bothhost and device roles easily perform the host and device roles in anenvironment where a fixed host such as a personal computer (PC) is notpresent, and in particular to a communication system, a communicationapparatus, a control method therefor, and a computer program in whichcommunication devices that are initially designated as a host and adevice exchange their host and device roles according to a predeterminedcommunication protocol.

2. Description of the Related Art

Universal serial bus (USB) is a general-purpose bus interface standardsupporting plug-and-play, which can replace legacy ports such as serial(RS-232C) and parallel ports. The USB specification was originallydeveloped by four companies such as Intel Corporation, and is nowdeveloped and managed by a non-profit organization called USBImplementers Forum, Inc. (USB-IF). USB 2.0 whose specification providesHigh-Speed mode (up to 480 megabits per second (Mbps)), which is higherthan IEEE 1394 transfer rates (up to 400 Mbps), has been widespread.

In USB, specifications called USB classes, which are grouped inaccordance with capabilities of peripheral devices, are defined. Devicescreated according to each class specification provide the same function,and class-compliant devices are operated by a class driver without usingdriver software specific to each device.

USB is originally a transmission scheme based on wire cables, in which aplurality of devices are connected via a common serial communication busto construct a USB communication system. Recently, an extension of USBinto wireless communication, called “Wireless USB (WUSB)”, in whichadvantages of wired communication, such as safe and high-speedcommunication, and advantages of wireless communication, such aseasy-to-use communication, are combined have been being developed. WUSBis based on Ultra Wide Band (UWB) technology, which is a wirelesstechnology using an ultra wideband, and adopts a multiband orthogonalfrequency division multiplexing (OFDM) system, which is promoted by theWiMedia Alliance, as a standard of the physical layer and media accesscontrol (MAC) layer. WUSB supports communication at rates up to 480 Mbpsfor a three-meter communication range and up to 110 Mbps for a ten-metercommunication range, and allows up to 127 devices to be connected to onehost by using a star topology.

In a USB communication system, one of a plurality of USB-connecteddevices achieves a function called “host” and the other devices achievea function called “device” (although “device” may also be referred to as“function” or “peripheral”, “device” is used throughout thisspecification). In a wired USB system, a USB cable has an asymmetricalstructure having an “A-plug” at an end thereof for connection to a hostand a “B-plug” at the other end thereof for connection to a device. Inthis case, since a device into which the A-plug is plugged acts as ahost and a device into which the B-plug is plugged acts as a device, therelationship between the host and the device is fixed.

A host serves to control overall data transmission over a USB interface,and a PC usually acts as a host. The host performs processing such asdetecting a new USB-connected device and managing the flow of data overa bus. Devices, on the other hand, perform communication under controlof the host. The devices communicate with only a host.

Basically, a host schedules USB-based communication and initiates thecommunication, and a device responds to the initiation of thecommunication. Specifically, a host delivers a request to a device, andthe device responds to the request, thereby performing communication.The device transfers its information to the host or transmits andreceives data to and from the host according to a response to requestsfrom the host.

USB has been widespread as a technology for establishing a connectionbetween, for example, a PC acting as a host and a peripheral device suchas a printer acting as a device, and has become the de-facto industrystandard. With the recent appearance of various USB-compatibleperipheral devices, a demand for connection between such peripheraldevices without the intervention of a PC has increased.

To meet the demand, USB On-The-Go (hereinafter referred to as “OTG”),which is a supplement to USB 2.0, has been developed. OTG allows a USB2.0 host controller function to be definitely added to a non-host devicesuch as a digital camera so that data can be directly transmittedbetween peripheral devices.

In a case where a PC and a peripheral device are connected using a USBinterface, the host-device relationship is fixed; the PC acts as a hostand the peripheral device acts as a device. The host-device relationshipis also uniquely determined from the type of plugs of a USB cable(described above). In a case where peripheral devices are directlyconnected, however, it is desirable to flexibly determine the host anddevice roles between USB-connected devices such that, for example, adigital camera acts as a device when it is connected to a PC, and actsas a host when it performs direct printing to a printer.

In OTG, a dual role device (DRD) is defined as a device having both hostand device functions. DRDs determine initial functions (host and device)according to the type of plugs of a USB cable connected to the DRDs. AnOTG-compatible USB cable has an asymmetrical structure having a plugcalled Mini-A at an end thereof and a plug called Mini-B at the otherend thereof. A Mini-A plugged device is initially a host, and a Mini-Bplugged device is initially a device. A Mini-A plugged device isreferred to as an “A-device”, and a Mini-B plugged device is referred toas a “B-device”.

OTG introduces communication protocols called Session Request Protocol(SRP) and Host Negotiation Protocol (HNP) in addition to the USB 2.0communication protocol.

The A-device, defined in OTG, is allowed to stop the supply of currentto a USB bus during a non-communication period. SRP is a communicationprotocol for allowing restart of the supply of current from the B-deviceto the A-device during a period in which the supply of current isstopped. By using SRP, the A-device is allowed to stop the supply ofcurrent to the USB bus until a request is issued from the B-device,resulting in a reduction in power consumption during thenon-communication period.

Two DRDs connected to an OTG-compatible USB cable initially determinetheir host and device roles according to the type of plugs of the cableplugged into the DRDs (described above). HNP is a communication protocolfor reversing the host and device roles without replugging the cablewhen one of the DRDs acts as a host and the other acts as a device. Itis therefore unnecessary to replug the cable, resulting in improvementof user convenience.

By using OTG, data can be exchanged directly between peripheral deviceswithout the intervention of a PC, such as between a digital camera or ascanner and a printer, between a mobile phone and a portable musicplayer or a memory card reader, and between a personal digital assistant(PDA) and a hard disk drive or a magneto optical (MO) drive. Forexample, a PDA and a mobile phone may be USB-connected so that the PDAcan be connected to the Internet, or a portable music player and amobile phone may be USB-connected so that music files can be downloadedto the portable music player via the Internet. Further, a digital cameraand a printer may be directly connected using a USB cable to perform“direct printing”.

One of communication standards that allow a digital camera and a printerto be USB-connected to perform direct printing is “PictBridge”, whichwas established by the Camera & Imaging Products Association (CIPA).PictBridge-compatible devices can perform direct printing withoutinstalling special software once they are connected using a USB cable. Auser can operate buttons or the like of a digital camera to easily printan image being displayed on a liquid crystal monitor of the digitalcamera. The digital camera has capabilities of, besides specifying printsetting (such as paper size), printing an image using printer defaultsettings if no settings are specified for that image. Other variouscapabilities as well as printing a specified image, such as indexprinting in which a list of thumbnail images is printed, printing aplurality of copies of the same image, and printing an image stampedwith date, are also utilized. If an event such as an error occurs duringprinting, an error warning may be displayed on the liquid crystalmonitor or the like of the digital camera.

In USB communication, users may enter instructions such as start or endof communication and various settings not only via a user interface (atouch panel, a keyboard, or any other input device) on the host side butalso via a user interface on the device side. This is to be understoodfrom an example in which in the PictBridge standard described above, aprinting instruction can be issued from a digital camera behaving as adevice to a printer acting as a host, and is based on a communicationprotocol established between devices that are USB-connected according tothe OTG standard.

In other words, a special communication protocol is used to transmit acertain command to the host by operating a user interface on the deviceside to instruct USB communication. Therefore, it is more effective inview of light communication load and easy design of devices that thehost instructs USB communication unless special purposes exist. It iscommon to perform various USB communication operations via a userinterface of a host device.

It is now assumed that a communication apparatus that is USB-connectedto a DRD is a DRD having a host controller function, that is, DRDs areUSB-connected.

The two DRDs are denoted by devices 1 and 2. The device 1, when actingas a host, supports devices that are generally different from thosesupported by the device 2 when acting as a host. However, if the devices1 and 2 support each other (that is, if one of the devices 1 and 2 isprovided with a device driver of the other device and vice versa), theA-device into which the Mini-A plug of the USB cable is plugged canperforms the host function without changing its initial function.

If various USB communication operations are to be performed via a userinterface on the host device, however, it is desirable to determine towhich of the devices 1 and 2 to assign the host function by taking intoaccount the operability of input devices, output devices, and otherdevices provided in the respective devices.

In a case where a USB communication system is established in which theA-device into which the Mini-A plug is plugged still acts as a hostwithout changing its initial role, the connection direction of the USBcable (that is, which device to plug each of the Mini-A plug and Mini-Bplug into) has no relationship with the operability of the userinterfaces of the devices, and a desired one of the devices is notnecessarily designated as a host. Since the A-device still acts as ahost and performs USB communication operations, even if the B-device ishigher in operability than the A-device, this characteristic may not beutilized.

Furthermore, it is not practical for users having no special knowledgeof USB technology to correctly determine the connection direction of theUSB cable by taking the operability of the devices 1 and 2 into accountor to replug the USB cable when the host device is low in operability.

Even USB-connected devices of the same type may differ in operability orhost-specific communication performance if the devices have differentfirmware versions. There may still arise a problem in that theoperability of the host and the connection direction of the USB cable donot coincide with each other, and users may not enjoy the benefit ofdevice's operability, which is higher than that of the host, andcommunication stability.

The problems caused by the A-device implementing the host functionwithout changing its initial role are not limited to unsuitability forthe physical operability of the devices.

It is difficult to plug the plug terminals at the ends of the USB cableinto two devices at the same time. A user generally plugs in sequenceone of the plugs into a desired device. When USB communication isenabled between the devices to which the USB cable is connected, thedevice plugged later may possibly be still held with the user's hand ormay possibly be near the user. It is therefore convenient due to reducedtime spent on user's movement or the like that USB communicationoperations be performed using the device plugged later (in other words,the host function be assigned to the device plugged later).

It is also convenient due to reduced time spent on user's movement orthe like that USB communication operations be performed using a devicewhose user interface has been operated by a user or a device that hasbeen moved around the user because such a device may be nearer the user.

It is also convenient due to reduced time spent on user's movement orthe like that USB communication operations be performed using one of twoUSB-connected devices that has an application operating thereon forperforming USB communication or that is being prepared for USBcommunication because the user may possibly desire to operate thisdevice.

Accordingly, it is desirable that a device whose user interface for USBcommunication is operated, that is, a device to which the host functionis assigned, be determined according to user convenience based onindividual use conditions or the statuses of the devices. However, thedetermined device may not coincide with a device that is determined onthe basis of the connection direction of the USB cable.

For example, a communication system in which connected DRDs exchangetheir host and device roles on the basis of communication capabilitiesof the DRDs to improve communication performance is disclosed in, forexample, Japanese Unexamined Patent Application Publication No.2005-250671. The disclosed communication system is designed to switchthe host and device roles between USB-connected DRDs to reduce powerconsumption or improve communication rates, but is not configured todetermine a host by taking into account the operability of the userinterfaces of the USB-connected devices or user convenience for enteringinstructions relating to USB communication. Thus, the foregoing problemis not overcome.

Further, an image output system configured to switch the host and deviceroles according to HNP when the connection direction of twoUSB-connected DRDs is wrong is disclosed in, for example, JapaneseUnexamined Patent Application Publication No. 2004-316072. The disclosedsystem is not configured to determine a host by taking into account theoperability of the user interfaces of the USB-connected devices or theuser convenience for entering instructions relating to USBcommunication. Thus, the foregoing problem is not overcome.

SUMMARY OF THE INVENTION

It is therefore desirable to provide a communication system, acommunication apparatus, a control method therefor, and a computerprogram in which a device acting as a host can control data transmissionover a communication interface while another device acting as a devicecan perform data transmission over the communication interface undercontrol of the host.

It is also desirable to provide a communication system, a communicationapparatus, a control method therefor, and a computer program in whichcommunication devices having both host and device roles can easilyperform the host and device roles in an environment where a fixed hostsuch as a PC is not present.

It is further desirable to provide a communication system, acommunication apparatus, a control method therefor, and a computerprogram in which communication devices that are initially designated asa host and a device can exchange their host and device roles accordingto a predetermined communication protocol.

It is further desirable to provide a communication system, acommunication apparatus, a control method therefor, and a computerprogram in which USB-connected devices can suitably exchange their hostand device roles, regardless of the initially set host and device roles,by taking into account the operability of user interfaces of the devicesor the user convenience for entering instructions relating to USBcommunication.

In a first embodiment of the present invention, there is provided acommunication system including a plurality of communication apparatusesconfigured to perform data transmission over a predeterminedcommunication interface that allows one of the communication apparatusesto act as a host and to control data transmission and that allows theother communication apparatuses to act as devices and to perform datatransmission under control of the host. The plurality of communicationapparatuses includes a first communication apparatus and a secondcommunication apparatus, the first communication apparatus and thesecond communication apparatus being connected to the predeterminedcommunication interface, and each of the first communication apparatusand the second communication apparatus has both host and device roles.The first communication apparatus and the second communication apparatusare configured to exchange the host and device roles by using apredetermined communication protocol. When the first communicationapparatus is designated as the host and the second communicationapparatus is designated as one of the devices, the communication systemfurther includes apparatus-information transmitting means fortransmitting apparatus information relating to a structure or specificinformation of the second communication apparatus to the firstcommunication apparatus; determining means for determining whether ornot to switch the host and device roles between the first communicationapparatus and the second communication apparatus according to apredetermined criterion when the first communication apparatus comparesthe apparatus information transmitted by the second communicationapparatus with apparatus information relating to a structure or specificinformation of the first communication apparatus; and switchingprocedure executing means for executing a procedure for switching thehost and device roles between the first communication apparatus and thesecond communication apparatus by using the predetermined communicationprotocol when an affirmative determination result is obtained from thedetermining means.

The term system as used herein refers to a logical set of apparatuses(or function modules implementing specific functions) regardless ofwhether or not the apparatuses or function modules are housed in asingle housing.

USB interfaces are de-facto industry standard communication interfacesfor establishing a connection between a PC and a peripheral device.Recently, to meet a demand for USB connection between peripheral deviceswithout the intervention of a PC, USB On-The-Go (hereinafter referred toas “OTG”), which is a supplement to USB 2.0, has been developed.

In OTG, a DRD is defined as a device having both host and devicefunctions. When DRDs are connected via a USB cable, the relationshipbetween a host and a device is initially determined according to thecommunication direction of the USB cable (the type of plugs plugged intothe devices). Afterwards, the host and device roles can be switched byusing HNP.

In a case where two devices are connected via a USB cable, it is commonto perform various USB communication operations via a user interface ofa host. However, users having poor knowledge about the USB standard maynot correctly connect the communication cable by taking into account theoperability of the devices or the user convenience based on individualuse conditions or the statuses of the devices, and a device that isinitially designated a host is not necessarily suitable as a host.

In the communication system according to the first embodiment of thepresent invention, when the first and second communication apparatuses,which are DRDs, are connected via a USB cable and the firstcommunication apparatus is initially designated as a host according tothe connection direction of the USB cable or the like, the determiningmeans compares an apparatus structure or apparatus specific informationstored in the first communication apparatus with an apparatus structureor apparatus specific information stored in the second communicationapparatus according to a predetermined criterion to determine whether ornot to switch the host and device roles between the first and secondcommunication apparatuses. If an affirmative determination result isobtained, the host and device roles are switched between the first andsecond communication apparatuses by using HNP.

According to the first embodiment of the present invention, therefore,the host/device roles can be switched to automatically assign theoptimal roles so as to improve operability for a user and to reduce theoperational load imposed on the user, such as changing of devices ormovement to another place, without forcing the user to replug the USBcable, resulting in improvement of user convenience using USBcommunication.

The determining means may determine whether or not to switch the hostand device roles between the first and second communication apparatusesaccording to a predetermined criterion that is based on an improvementin user operability or an improvement in user convenience.

The apparatus information transmitted by the apparatus informationtransmitting means may include, for example, hardware versioninformation or software version information of the correspondingcommunication apparatus. In a case where the connected communicationapparatuses are of the same type, a communication apparatus having anewer version can be possibly have higher in operability, functionality,communication stability, etc. Thus, it may be more advantageous for auser to operate a device with newer version information as a host.

Further, the apparatus information transmitted by the apparatusinformation transmitting means may include, for example, informationrelating to an output device or input device included in thecorresponding communication apparatus. The representation performance ofa display unit serving as the output device increases as the screenresolution, or the amount of information per pixel, increases. It istherefore more advantageous for a user to operate a device having ahigher screen resolution as a host. Further, it is desirable that adevice equipped with an input device of a type having a higheroperability be designated as a host.

In a second embodiment of the present invention, there is provided acommunication system including a plurality of communication apparatusesconfigured to perform data transmission over a predeterminedcommunication interface that allows one of the communication apparatusesto act as a host and to control data transmission and that allows theother communication apparatuses to act as devices and to perform datatransmission under control of the host. The plurality of communicationapparatuses includes a first communication apparatus and a secondcommunication apparatus, the first communication apparatus and thesecond communication apparatus being connected to the predeterminedcommunication interface, and each of the first communication apparatusand the second communication apparatus has both host and device roles.The first communication apparatus and the second communication apparatusare configured to exchange the host and device roles by using apredetermined communication protocol. When the first communicationapparatus is designated as the host and the second communicationapparatus is designated as the device, the communication system furtherincludes apparatus-status-information transmitting means fortransmitting apparatus-status information relating to a status of thesecond communication apparatus to the first communication apparatus;determining means for determining whether or not to switch the host anddevice roles between the first communication apparatus and the secondcommunication apparatus according to a predetermined criterion when thefirst communication apparatus compares the apparatus-status informationtransmitted by the second communication apparatus with apparatus-statusinformation relating to a status of the first communication apparatus;and switching procedure executing means for executing a procedure forswitching the host and device roles between the first communicationapparatus and the second communication apparatus by using thepredetermined communication protocol when an affirmative determinationresult is obtained from the determining means.

The problems caused by the device, which is initially designated as ahost according to the connection direction of the USB, stillimplementing the host function without changing its initial role are notlimited to unsuitability for the physical operability of the devices. Toaddress those problems, the communication system according to the secondembodiment of the present invention is configured to change the hostfunction to a suitable device by taking into account the operability ofUSB-connected device or the user convenience based on the individual useconditions or the statuses of the devices.

Also in the communication system according to the second embodiment ofthe present invention, the determining means may determine whether ornot to switch the host and device roles between the first and secondcommunication apparatuses according to a predetermined criterion that isbased on an improvement in user operability or an improvement in userconvenience.

The apparatus-status information transmitted by theapparatus-status-information transmitting means may include, forexample, information indicating whether or not the correspondingcommunication apparatus is ready to perform communication, and a statusof an application operating on the communication apparatus. In a casewhere a copy of data or the like is transferred between twocommunication apparatuses, in a situation where either apparatus isavailable for a communication operation, a user might possibly desire tooperate one of the apparatuses that has an application operating thereonfor copying data. That is, higher user convenience is obtained byoperating the apparatus that is ready for communication. Therefore, itis desirable that the communication apparatus that has been prepared forcommunication be designated as a host.

Further, the apparatus-status information transmitted by theapparatus-status-information transmitting means may include, forexample, information relating to a time that has elapsed since thecorresponding communication apparatus was connected to the predeterminedcommunication interface (that is, a USB cable). A user generallyconnects the communication cable to one of the communication apparatusesin sequence. The later connected communication apparatus may possibly beheld with the user's hand or may possibly be near the user. Theoperation on the later connected communication apparatus would providehigher convenience due to reduced time spent on changing of theapparatuses, user's movement, or the like. Therefore, it is desirablethat the apparatus having information of less elapsed time since thecable was plugged in be designated as a host.

Further, the apparatus-status information transmitted by theapparatus-status-information transmitting means may include, forexample, information relating to a time that has elapsed since the lasttime a user operated the corresponding communication apparatus. Thecommunication apparatus that was operated by the user later may possiblybe held with the user's hand or may possibly be near the user.Therefore, it is desirable that the apparatus having information of lesselapsed time since last user operation be designated as a host.

In a third embodiment of the present invention, there is provided acomputer-readable computer program for performing control of acommunication apparatus on a computer, the communication apparatus beingconfigured to perform a communication operation over a predeterminedcommunication interface that allows one of a plurality of communicationapparatuses to act as a host and to control data transmission and thatallows the other communication apparatuses to act as devices and toperform data transmission under control of the host, the communicationapparatus having both host and device roles, the predeterminedcommunication interface being specified by a predetermined communicationprotocol for switching the host and device roles between thecommunication apparatuses. The computer program causing the computer toexecute the steps of transmitting, when the communication apparatus isdesignated as the device, apparatus information relating to a structureor specific information of the communication apparatus to acommunication apparatus acting as the host over the predeterminedcommunication interface; receiving, when the communication apparatus isdesignated as the host, the apparatus information from a secondcommunication apparatus acting as the device over the predeterminedcommunication interface; comparing, when the communication apparatus isdesignated as the host, the apparatus information transmitted by thesecond communication apparatus with the apparatus information relatingto a structure or specific information of the communication apparatus todetermine whether or not to switch the host and device roles between thecommunication apparatus and the second communication apparatus accordingto a predetermined criterion; and executing, when an affirmativedetermination result is obtained, a procedure for switching the host anddevice roles between the communication apparatus and the secondcommunication apparatus by suing the predetermined communicationprotocol.

In a fourth embodiment of the present invention, there is provided acomputer-readable computer program for performing control of acommunication apparatus on a computer, the communication apparatus beingconfigured to perform a communication operation over a predeterminedcommunication interface that allows one of a plurality of communicationapparatuses to act as a host and to control data transmission and thatallows the other communication apparatuses to act as devices and toperform data transmission under control of the host, the communicationapparatus having both host and device roles, the predeterminedcommunication interface being specified by a predetermined communicationprotocol for switching the host and device roles between thecommunication apparatuses. The computer program causing the computer toexecute the steps of transmitting, when the communication apparatus isdesignated as the device, apparatus-status information relating to astatus of the communication apparatus to a communication apparatusacting as the host over the predetermined communication interface;receiving, when the communication apparatus is designated as the host,the apparatus-status information from a second communication apparatusacting as the device over the predetermined communication interface;comparing, when the communication apparatus is designated as the host,the apparatus-status information transmitted by the second communicationapparatus with apparatus-status information relating to a status of thecommunication apparatus to determine whether or not to switch the hostand device roles between the communication apparatus and the secondcommunication apparatus according to a predetermined criterion; andexecuting, when an affirmative determination result is obtained, aprocedure for switching the host and device roles between thecommunication apparatus and the second communication apparatus by suingthe predetermined communication protocol.

The computer program according to the third and fourth embodiments ofthe present invention defines a computer program written in acomputer-readable manner so as to implement predetermined processing ona computer. In other words, the computer program according to the thirdand fourth embodiments of the present invention is installed in acomputer to exert a cooperative effect on the computer to cause thecomputer to operate as the first or second communication apparatus. Byconnecting such communication apparatuses via a predeterminedcommunication interface such as a USB interface, advantages similar tothose of the communication system according to the first to secondembodiments of the present invention can be achieved.

According to an embodiment of the present invention, a communicationsystem, a communication apparatus, a control method therefor, and acomputer program in which communication devices having both host anddevice roles can easily perform the host and device roles in anenvironment where a fixed host such as a PC is not present can beachieved.

According to another embodiment of the present invention, acommunication system, a communication apparatus, a control methodtherefor, and a computer program in which communication devices that areinitially designated as a host and a device can exchange their host anddevice roles according to a predetermined communication protocol can beachieved.

According to another embodiment of the present invention, acommunication system, a communication apparatus, a control methodtherefor, and a computer program in which USB-connected devices cansuitably exchange their host and device roles, regardless of theinitially set host and device roles, by taking into account theoperability of user interfaces of the devices or the user conveniencefor entering instructions relating to USB communication can be achieved.

According to another embodiment of the present invention, whenOTG-compatible DRDs are connected, the host/device roles are notdetermined merely according to the direction of the USB cable, but thefunctions can be switched to automatically assign the optimal roles soas to improve operability for a user and to reduce the operational loadimposed on the user, such as changing of devices or movement to anotherplace.

The communication system according to the embodiments of the presentinvention can be configured to perform control by using a methodcomplying with the USB 2.0 and OTG standards, and can be easily appliedto devices compatible with those standards. Such control can also beimplemented by executing a predetermined software program on a computer.Thus, the functions of the embodiments of the present invention can beimplemented only by modifying the program without changing the hardwareconfiguration of the devices.

Further features and advantages of the present invention will becomeapparent from the following detailed description of the preferredembodiments of the present invention taken in conjunction with theaccompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic block diagram showing a structure of acommunication system according to an embodiment of the presentinvention;

FIG. 2 is a block diagram showing in detail an internal structure of acommunication processing unit in a first communication apparatus in thecommunication system;

FIG. 3A is a diagram showing switching of host and device roles betweenthe communication processing unit in the first communication apparatusand a communication processing unit in a second communication apparatus(wherein the first communication apparatus acts as a host and a secondcommunication apparatus acts as a device);

FIG. 3B is a diagram showing switching of host and device roles betweenthe communication processing units (wherein the first communicationapparatus acts as a device and the second communication apparatus actsas a host);

FIG. 4 is a flowchart showing an operating procedure performed by thefirst communication apparatus acting as the A-device;

FIG. 5 is a diagram showing an example of the data structure of an ‘OTGDevice Information’ descriptor;

FIG. 6 is a diagram showing an example of the correspondence betweenvalues stored in a ‘type of input device (operation unit)’ field of the‘OTG Device Information’ descriptor and types of input devices;

FIG. 7 is a diagram showing an example of the correspondence betweenvalues stored in a ‘type of resolution of output device (display unit)’field of the ‘OTG Device Information’ descriptor and screen resolutionsof output devices;

FIG. 8 is a diagram showing a specific example of ‘OTG DeviceInformation’ descriptors of the A-device and B-device in a case wheretwo USB-connected communication apparatuses are of different types;

FIG. 9 is a diagram showing a specific example of ‘OTG DeviceInformation’ descriptors of the A-device and B-device in a case wheretwo USB-connected communication apparatuses are of the same type;

FIG. 10 is a flowchart showing an operating procedure performed by thefirst communication apparatus acting as the A-device;

FIG. 11 is a diagram showing an example of the data structure of an ‘OTGDevice Status’ descriptor; and

FIG. 12 is a diagram showing a specific example of an ‘OTG DeviceStatus’ descriptor of the B-device (the second communication apparatus).

DESCRIPTION OF THE PREFERRED EMBODIMENTS

Embodiments of the present invention will be described in detailhereinafter with reference to the drawings.

FIG. 1 schematically shows a structure of a communication systemaccording to an embodiment of the present invention. The system includesa communication cable 50 and communication apparatuses 101 and 102. Asdescribed below, the communication apparatuses 101 and 102 are DRDsdefined in OTG, which is a supplement to USB 2.0.

As shown in FIG. 1, the communication apparatus 101 includes acommunication processing unit 11, a control unit 21, a storage unit 31,an operation unit 61, a display unit 71, and a receptacle terminal 41.The communication apparatus 102 includes a communication processing unit12, a control unit 22, a storage unit 32, an operation unit 62, adisplay unit 72, and a receptacle terminal 42. Those components will nowbe described.

The communication cable 50 is an OTG-compatible communication cable, andhas a Mini-A plug terminal 51 at an end thereof and a Mini-B plugterminal 52 at the other end thereof.

The communication apparatuses 101 and 102 are DRDs defined in OTG, andare provided with the receptacle terminals 41 and 42, respectively. Thereceptacle terminals 41 and 42 are OTG-specified DRD terminals, and are“Mini-AB receptacle terminals” to which either the Mini-A or Mini-B plugterminal is attachable.

The communication apparatuses 101 and 102 initially determinehost/device roles according to the connection direction of thecommunication cable 50. Specifically, the communication apparatus 101 or102 initially acts as the A-device or a host when the Mini-A plugterminal 51 is connected to the receptacle terminal 41 or 42, andinitially acts as the B-device or a device when the Mini-B plug terminal52 is connected to the receptacle terminal 41 or 42.

In the example shown in FIG. 1, the Mini-A plug terminal 51 is pluggedinto the receptacle terminal 41 of the communication apparatus 101, andthe Mini-B plug terminal 52 is plugged into the receptacle terminal 42of the communication apparatus 102. In the illustrated example,therefore, the communication apparatus 101 initially acts as theA-device or a host, and the communication apparatus 102 initially actsas the B-device or a device.

It is common to perform various USB communication operations via a userinterface of one of two USB-connected devices, which acts as a host.However, users having poor knowledge about the USB standard may notcorrectly connect the communication cable 50 by taking into account theoperability of the devices or user convenience based on the individualuse conditions or the statuses of the devices, and a device that isinitially designated as a host is not necessarily suitable as a host.According to an embodiment of the present invention, the host/deviceroles can be switched to automatically assign the optimal roles so as toimprove operability for a user and to reduce the operational loadimposed on the user, such as changing of devices or movement to anotherplace, without forcing the user to replug the communication cable 50.This operation is described in detail below.

The communication processing unit 11 performs various types of USB- andOTG-compliant communication processing according to instructions givenby the control unit 21. For example, the communication processing unit11 transmits and receives data according to the USB specification orswitches the host/device roles according to the OTG specification inresponse to an instruction given by the control unit 21. Thecommunication processing unit 12 has a function to perform, in thecommunication apparatus 102, operations similar to those of thecommunication processing unit 11. That is, the communication processingunit 12 performs various types of USB- and OTG-compliant communicationprocessing in response to instructions given by the control unit 22.

FIG. 2 shows an internal structure of the communication processing unit11 in the communication apparatus 101 in more detail. As shown in FIG.2, the communication processing unit 11 includes an OTG unit 111, a hostunit 112, and a device unit 113. The communication processing unit 12 inthe communication apparatus 102 has a structure similar to that shown inFIG. 2.

The OTG unit 111 performs various types of OTG-compliant communicationprocessing. For example, the OTG unit 111 causes the A-device to restartthe supply of current by using SRP, or switches the host/device rolesbetween the communication apparatuses 101 and 102 by using HNP. The OTGunit 111 further performs processing such as initially determining thehost or device role according to the type of the plug terminal (Mini-Aplug terminal or Mini-B plug terminal) plugged into the receptacleterminal 41, that is, the connection direction of the USB cable 50, orcontrolling the supply of a clock to the host unit 112 and the deviceunit 113.

The host unit 112 executes communication processing when thecommunication apparatus 101 acts as a host. That is, the host unit 112executes USB host-specific communication processing such as detectinganother device to which the communication cable 50 is connected orcontrolling data transmission via the communication cable 50.

The device unit 113 executes communication processing when thecommunication apparatus 101 acts as a device. That is, the device unit113 executes USB device-specific communication processing under controlof the host.

The OTG unit 111 exclusively supplies a clock to one of the host unit112 and the device unit 113. The communication processing unit 11 actsas a host when a clock is supplied to the host unit 112, and acts as adevice when a clock is supplied to the device unit 113. That is, thecommunication apparatus 101 is a DRD and is capable of switching thehost/device roles according to whether a clock is supplied from the OTGunit 111 to the host unit 112 or the device unit 113 in thecommunication processing unit 11. The communication apparatus 102 alsoperforms processing similar to that described above.

FIGS. 3A and 3B show switching of the host and device roles between thecommunication processing units 11 and 12.

In the example shown in FIG. 1, the communication apparatus 101initially acts as a host and the communication apparatus 102 initiallyacts as a device. In this case, in the communication processing unit 11,as shown in FIG. 3A, a clock is supplied to the host unit 112 and thesupply of a clock to the device unit 113 is stopped under control of theOTG unit 111. In the communication processing unit 12, conversely, aclock is supplied to the device unit and the supply of a clock to thehost unit is stopped.

When the host/device roles are switched by using HNP, as shown in FIG.3B, in the communication processing unit 11, the supply of a clock tothe host unit 112 is stopped and the supply of a clock to the deviceunit 113 is started under control of the OTG unit 111. In thecommunication processing unit 12, conversely, the supply of a clock tothe device unit is stopped and the supply of a clock to the host unit isstarted. Thus, role switching occurs so that the communication apparatus101 acts as a device and the communication apparatus 102 acts as a host.The communication apparatuses 101 and 102 exchange their host/deviceroles without replugging the plug terminals 51 and 52 of thecommunication cable 50.

The foregoing description has been made in the context of an example inwhich the communication apparatus 101 is the A-device. In a case wherethe communication apparatus 102 is the A-device, a procedure similar tothat described above is performed to switch the host/device roles.

The control unit 21 performs various types of processing to control theoverall operation of the communication apparatus 101. For example, thecontrol unit 21 performs processing for obtaining various types ofinformation necessary for the communication processing unit 11 acting asa host to start communication with a communication partner acting as adevice. Specifically, the control unit 21 controls the communicationprocessing unit 11 to transmit various USB requests to the device, andcontrols the communication processing unit 11 to receive responses tothe requests from the device, thereby obtaining information regardingthe device. After the necessary information is obtained, the controlunit 21 controls the communication processing unit 11 on the basis ofthe obtained information to communicate with the device.

The control unit 21 further controls the communication processing unit11 to perform, when the communication processing unit 11 acts as adevice, communication under control of a communication partner acting asa host. That is, the control unit 21 controls the communicationprocessing unit 11 to receive a request from the host to generate a USBresponse to the request, and controls the communication processing unit11 to transmit the response to the host device.

The control unit 22 has a function to perform, in the communicationapparatus 102, operations similar to those of the control unit 21. Thatis, the control unit 22 performs various types of processing to controlthe overall operation of the communication apparatus 102 in the mannersimilar to that described above.

While the communication apparatuses 101 and 102 are DRDs, the A-devicedetermined according to the connection direction of the communicationcable 50 is not necessarily suitable as a host in view of itsoperability or individual use conditions or statuses of devices. In anembodiment of the present invention, the host/device roles can beswitched to automatically assign the optimal roles so as to improveoperability for a user and to reduce the bothersome operational loadimposed on the user, such as changing of devices or movement to anotherplace, without forcing the user to replug the communication cable 50.The control units 21 and 22 play primary roles to implement suchfunctions, the details of which are described below.

The storage unit 31 stores data transmitted and received by thecommunication processing unit 11 and various types of informationnecessary for communication processing. Examples of the informationstored in the storage unit 31 include a descriptor. The descriptor isdata used for the host to obtain information concerning the device, andhas a predetermined data structure defined in USB.

The storage unit 32 has a function similar to that of the storage unit31. That is, the storage unit 32 stores data transmitted and received bythe communication processing unit 12 in the communication apparatus 102and various types of information necessary for communication processing.

The operation unit 61 detects or identifies an instruction entered bythe user to perform the operation of the communication apparatus 101,and notifies the control unit 21 of the result. The operation unit 61 isformed of an input device including various operation buttons, akeyboard, a mouse, a touch panel, and a tablet.

The operation unit 62 has a function to perform, in the communicationapparatus 102, operations similar to those of the operation unit 61.That is, the operation unit 62 detects or identifies an instructionentered by the user to perform the operation of the communicationapparatus 102, and notifies the control unit 22 of the result.

The display unit 71 provides display of a user interface screen or thelike of the communication apparatus 101. The display unit 71 is formedof an output device including a display device such as a liquid crystaldisplay, a cathode ray tube (CRT) display, a viewfinder, or a lightemitting device (LED) display.

The display unit 72 has a function to perform, in the communicationapparatus 102, operations similar to those of the display unit 71. Thatis, the display unit 72 provides display of a user interface screen orthe like of the communication apparatus 102.

In the communication system shown in FIG. 1, the communicationapparatuses 101 and 102 are DRDs, and initially determine thehost/device roles according to the connection direction of thecommunication cable 50. In some cases, however, it is not desirable inview of operability of devices or user convenience based on individualuse conditions or the statuses of the devices that the A-device stillperforms the host function without changing its initial role. Anembodiment of the present invention provides a solution to a problemcaused by assigning the host function to the A-device without changingits initial role. Two embodiments will be described hereinafter.

In either of the embodiments, the control units 21 and 22 in thecommunication apparatuses 101 and 102 play primary roles. This meansthat embodiments of the present invention can be implemented byexecuting a predetermined software program on a computer, and thefunctions of the embodiments of the present invention can also beimplemented merely by mortifying the program without changing thehardware of devices.

First Embodiment

FIG. 4 is a flowchart of an operating procedure performed by thecommunication apparatus 101 acting as the A-device. The operatingprocedure shown in FIG. 4 is implemented by the control unit 21executing predetermined program code. It is noted that an operatingprocedure similar to that described above is performed when theconnection direction of the communication cable 50 is reversed so thatthe communication apparatus 102 acts as the A-device.

At the time of power-on, the communication processing unit 11 of thecommunication apparatus 101 detects the type of a plug attached to thereceptacle terminal 41, and notifies the control unit 21 of thedetection result. In the example shown in FIG. 1, since the Mini-A plugterminal 51 is attached to the receptacle terminal 41, the control unit21 instructs the OTG unit 111 to supply a clock to the host unit 112,and starts the control of the communication apparatus 101 acting as theA-device. In the communication apparatus 102, which is a communicationpartner of the communication apparatus 101, the Mini-B plug terminal 52attached to the receptacle terminal 42 is detected, and the control unit22 starts the control to act as the B-device.

First, the control unit 21 obtains, in the course of enumerationprocessing, a descriptor from the communication apparatus 102 acting asthe device (step S11). The enumeration processing is a communicationprocedure defined in USB, which is executed when a host and a devicestart communication. In the enumeration processing, the host collectsvarious types of information concerning the device, and establishes aconnection with the device.

Then, the control unit 21 stores in the storage unit 31 variousdescriptors obtained by the communication processing unit 11 from thecommunication apparatus 102 in the enumeration processing (step S12).

The control unit 21 determines whether or not the descriptors obtainedfrom the communication partner include a predetermined descriptorincluding various types of information concerning the device (step S13).

The predetermined descriptor including various types of informationconcerning the device is hereinafter referred to as an “‘OTG DeviceInformation’ descriptor”. The ‘OTG Device Information’ descriptor storessoftware and hardware information concerning a communication apparatus,information relating to input and output devices provided in thecommunication apparatus, etc.

FIG. 5 shows an example of the data structure of the ‘OTG DeviceInformation’ descriptor. The ‘OTG Device Information’ descriptor shownin FIG. 5 includes the following data fields: from the beginning,‘descriptor length’, ‘descriptor type’, ‘descriptor index’, ‘hardwareversion information’, ‘firmware version information’, ‘type of inputdevice (operation unit)’, ‘type of resolution of output device (displayunit)’, ‘size (inch) of output device (display unit)’, and ‘amount ofinformation (bit) per pixel of output device (display unit)’.

The ‘descriptor length’ field contains a total number of bytes of thedescriptor. The ‘descriptor type’ field contains an identifier foridentifying the descriptor. The ‘descriptor index’ field contains anindex if a plurality of descriptors exist.

The ‘hardware version information’ field contains version information ofhardware of the communication apparatus. In products of the same type,the hardware may be updated during its life cycle although thefunctionality may not be largely changed. This field is used todetermine whether or not such update has been made. In general, thelarger the number, the more the product has been improved.

The ‘firmware version information’ field contains version information offirmware for controlling the communication apparatus. In mostapparatuses, the firmware is rewritable for debugging or additionalfunctionality. This field is used to determine the actually writtenfirmware. In general, the larger the number, the newer or more improvedthe firmware.

The ‘type of input device (operation unit)’ field contains a value forspecifying the type of an input device serving as an operation unit ofthe communication apparatus. FIG. 6 shows an example of thecorrespondence between values and types of input devices.

The ‘type of resolution of output device (display unit)’ field containsa value for specifying a resolution of an output device serving as adisplay unit of the communication apparatus. FIG. 7 shows an example ofthe correspondence between values and screen resolutions of outputdevices.

The ‘size (inch) of output device (display unit)’ field contains a size(expressed in inch) of the output device serving as a display unit ofthe communication apparatus.

The ‘amount of information (bit) per pixel of output device (displayunit)’ field contains an amount of information (expressed in bit) perpixel in the output device serving as a display unit of thecommunication apparatus. For example, value 8 is stored for a monochromeliquid crystal monitor with luminance information of 8 bits, and value24 is stored for a color liquid crystal monitor using 8 bits for each ofred, green, and blue.

When such an ‘OTG Device Information’ descriptor is obtained from thecommunication partner (that is, the communication apparatus 102), thecontrol unit 21 refers to the obtained ‘OTG Device Information’descriptor of the communication partner and the ‘OTG Device Information’descriptor of the communication apparatus 101, which is stored in thestorage unit 31, to compare the operability for the user between a casewhere the host/device roles have been switched and a case otherwise(step S14).

The ‘hardware version information’ and ‘firmware version information’fields are checked to determine the operability, functionality, andcommunication stability. If the connected communication apparatuses areof the same type, a communication apparatus with a new version may behigher in operability, functionality, and communication stability, etc.,than a communication apparatus with an old version. It is moreadvantageous for the user to operate the apparatus with newer versioninformation (a larger value), and it is therefore desirable that theapparatus with newer version information (a larger value) be designatedas a host. If the connected communication apparatuses are not of thesame type, it is not effective to compare version information, and the‘hardware version information’ and ‘firmware version information’ fieldsare ignored.

The determination as to whether the connected communication apparatusesare of the same type is performed by referring to the fields of devicedescriptors among the descriptors stored in the storage unit 31 in stepS12, such as ‘bDeviceClass’, ‘bDeviceSubClass’, ‘idvender’, ‘idproduct’fields, and determining whether or not those fields for thecommunication apparatuses coincide with each other. The determinationmay also be performed by using character strings indicating the name ofmanufacturer and the name of product in a string descriptor, which arespecified by ‘iManufacturer’ and ‘iProduct’ fields of the devicedescriptor, respectively.

If the connected communication apparatuses are of different types, thedetermination in step S14 is performed using the ‘type of input device(operation unit)’, ‘type of resolution of output device (display unit)’,‘size (inch) of output device (display unit)’, ‘amount of information(bit) per pixel of output device (display unit)’ fields.

As the values increases for the screen resolution determined from the‘type of resolution of output device (display unit)’ field, the sizespecified in the ‘size (inch) of output device (display unit)’ field,and the amount of information specified in the ‘amount of information(bit) per pixel of output device (display unit)’ field, therepresentation performance of the output device also increases. It ismore advantageous for the user to operate the apparatus having largervalues, and it is therefore desirable that the apparatus having largervalues be designated as a host. For the type specified in the ‘type ofinput device (operation unit)’ field, it is desirable that the apparatusincluding an input device that is regarded as higher-operability devicebe designated as a host.

In the ‘OTG Device Information’ descriptor shown in FIG. 5, the fieldsrelating to input and output devices are based on one input device andone output device. If a plurality of input devices or output devices areprovided, parameters of the input device or output device having thehighest operability or the highest performance are stored.Alternatively, the size of the ‘OTG Device Information’ descriptor maybe changed to store fields for a plurality of input devices and outputdevices. This allows comprehensive determination on the improvement inoperability from the performance states of the plurality of input andoutput devices in step S14.

Accordingly, the fields of the ‘OTG Device Information’ descriptors ofthe communication apparatuses 101 and 102 are compared to determinewhether or not to switch the operating modes.

The determination processing of step S14 will now be described withreference to a specific example of the ‘OTG Device Information’descriptors shown in FIGS. 8 to 9.

FIG. 8 shows a specific example of the ‘OTG Device Information’descriptors of the A-device and B-device in a case where twoUSB-connected communication apparatuses are of different types.

Since apparatuses of different types are connected, the ‘hardwareversion information’ and ‘firmware version information’ fields areignored in the determination processing.

The A-device has the ‘type of input device (operation unit)’ field setto 0×00, which indicates several dedicated hardware keys, and theB-device set to 0×01, which indicates a touch panel. The B-deviceequipped with a touch panel normally has a higher operability than theA-device equipped with only dedicated hardware keys.

The A-device has the ‘type of resolution of output device (displayunit)’ field set to 0×03, which indicates a resolution of 320×240, andthe B-device set to 0×07, which indicates a resolution of 640×480. TheB-device with a higher resolution has a higher operability.

The ‘size (inch) of output device (display unit)’ and ‘amount ofinformation (bit) per pixel of output device (display unit)’ fields areset to the same value for both the A-device and the B-device.

As a result of the comparison of the respective fields, the B-device hasa higher operability, and therefore it is determined that the switchingof the host/device roles would improve operability for a user.

FIG. 9 shows a specific example of the ‘OTG Device Information’descriptors of the A-device and B-device in a case where twoUSB-connected communication apparatuses are of the same type.

The ‘hardware version information’ field is set to the same value forboth the A-device and the B-device. As can be seen from the ‘firmwareversion information’ field, since the A-device has a newer firmwareversion, the A-device can be higher in operability and stability. Theremaining fields are set to the same values for both the A-device andthe B-device.

As a result of the comparison of the respective fields, the A-device hasa higher operability, and therefore it is determined that the switchingof the operating modes would not improve operability.

While FIGS. 8 and 9 show simple examples, a more complex situation mayoccur in actual use. For example, the A-device may be determined to bemore suitable as a host on the basis of a certain field; whereas theB-device may be determined to be more suitable as a host on the basis ofanother field. To address such a complex situation, priorities may beallocated in advance to the individual fields to be used for thedetermination processing, or determination results for the respectivefields may be scored and the scores may be weighted and summed beforethe determination processing is performed.

As a result of comparison in operability between the A-device and theB-device, if it is determined that the switching of the host/deviceroles would improve user operability (Yes in step S14), the control unit21 controls the communication processing unit 11 to switch thehost/device roles between the communication apparatuses 101 and 102 byusing HNP. More specifically, an acceptance of switching the host/deviceroles is transmitted to the device (step S15) before the host/deviceroles are actually switched (step S16). Thus, the host/device roleswitching process ends, and the communication apparatuses 101 and 102now act as the device and the host, respectively, to perform theircommunication operations.

As a result of comparison in operability between the A-device and theB-device, if it is determined that the switching of the host/deviceroles would not improve user operability (No in step S14), theprocessing routine ends, and the communication apparatuses 101 and 102still act as the host and the device, respectively, to perform theircommunication operations.

Next, an example of a communication procedure performed by thecommunication apparatus 101 acting as the A-device with respect to thecommunication apparatus 102 acting as the B-device according to theoperating procedure shown in FIG. 4 will be described.

Upon detection of the B-device being USB-connected, the A-deviceexecutes the enumeration processing described above. In the enumerationprocessing, the A-device transmits a standard USB request ‘GetDescriptor (Configuration)’ to the B-device.

‘Get Descriptor’ is a request for requesting the transmission of adescriptor including apparatus information concerning a device from thedevice to the host. The ‘Get Descriptor (Configuration)’ is a requestfor specifying a descriptor including information relating to apparatusperformance or functionality, called ‘configuration descriptor’, as adescriptor that is requested to the device.

According to OTG, upon a request for a ‘configuration descriptor’ comingfrom a host device using the ‘Get Descriptor (Configuration)’, a DRDtransmits a descriptor called ‘OTG descriptor’, in addition to the‘configuration descriptor’, to the host device. The ‘OTG descriptor’ isa descriptor including information indicating whether or not the DRDsupports SRP and HNP.

In a standard transaction, upon receipt of a ‘Get Descriptor(Configuration)’ request from a host device, a DRD transmits the ‘OTGdescriptor’ to the A-device in addition to the ‘configurationdescriptor’ and its relevant descriptor.

In the first embodiment, the communication apparatus 101 or 102transmits the ‘OTG Device Information’ descriptor described above to theA-device in addition to the ‘OTG descriptor’.

The ‘OTG Device Information’ descriptor is a method complying with theUSB 2.0 and OTG standards, and is transmitted from the B-device to theA-device.

The A-device compares the obtained ‘OTG Device Information’ descriptorwith the ‘OTG Device Information’ descriptor of the A-device. If it isdetermined on the basis of the comparison result that the switching ofthe host/device roles would improve operability, the A-device transmitsan additional standard request ‘Set Feature (b_hnp_enable)’ to theB-device by using OTG. Upon receipt of the request, the B-devicerecognizes that the switching of the host/device roles has beenaccepted, and returns an affirmative response to the A-device.

Upon receipt of the affirmative response from the B-device, the A-devicesets the communication state into a suspend state, and stops thecommunication with the B-device. When the B-device recognizes suspensionof the communication, the A-device and the B-device exchange theirhost/device roles by using HNP, and the A-device changes its role to adevice while the B-device changes its role to a host.

Although not specifically shown in FIG. 4, if the ‘OTG descriptor’obtained from the B-device includes HNP-incompatible information, theA-device does not perform HNP-based control, and the devices perform thecommunication operations without changing their initial host/deviceroles.

In the first embodiment, therefore, the communication apparatus 101 or102, when initially acting as a host, obtains a descriptor from thecommunication partner acting as a device under control of the controlunit 21 or 22, the descriptor containing software and hardwareinformation concerning a communication apparatus, information relatingto input and output devices provided in the communication apparatus,etc. The control unit 21 or 22 refers to the obtained descriptor of thecommunication partner and the descriptor stored therein to determinewhether or not the switching of the host/device roles would improveoperability. If it is determined that the switching of the host/deviceroles would improve operability, the communication partner is notifiedof an acceptance of switching the host/device roles by using HNPaccording to an instruction given by the control unit 21 or 22, and thehost/device roles are switched by using HNP.

With the operation described above, even if the high operability of theB-device is not fully utilized in an initial state where thecommunication cable 50 is connected, the host/device roles areautomatically switched to allow the user to enjoy USB communication withhigh operability.

Since the operating procedure for obtaining information concerning thecommunication partner and switching the host/device roles is performedusing a method complying with the USB 2.0 and OTG standards, the firstembodiment can be readily applied to devices compatible with thosestandards.

Further, the processing for switching the host/device roles, describedabove, is executed primarily by the control units 21 and 22. This meansthat the processing can be implemented by a computer. Thus, an existingcommunication apparatus whose overall operations involving communicationprocessing are controlled by a computer can also implement the functionsof the first embodiment by modifying a program without speciallychanging the hardware configuration thereof.

Second Embodiment

In the first embodiment, the host/device roles initially assigned to theA-device and the B-device are switched by taking operability of devicesinto account. In a second embodiment of the present invention, on theother hand, the host/device roles are switched on the basis of userconvenience based on the individual use conditions of the devices or thestatuses of the devices.

It is convenient due to reduced time spent on user's movement or thelike that, for example, the host function be assigned to a deviceplugged later. It is also convenient due to reduced time spent on user'smovement or the like that the host function be assigned to a devicewhose user interface has been operated by a user or a device that hasbeen moved around the user. It is also convenient due to reduced timespent on user's movement or the like that the host function be assignedto a device that has an application operating thereon for performing USBcommunication or that is being prepared for USB communication.

FIG. 10 is a flowchart showing an operating procedure performed by thecommunication apparatus 101 acting as the A-device. The operatingprocedure shown in FIG. 10 is implemented by the control unit 21executing predetermined program code. It is noted that an operatingprocedure similar to that described above is performed when theconnection direction of the communication cable 50 is reversed so thatthe communication apparatus 102 acts as the A-device.

At the time of power-on, the communication processing unit 11 of thecommunication apparatus 101 detects the type of a plug attached to thereceptacle terminal 41, and notifies the control unit 21 of thedetection result. In the example shown in FIG. 1, since the Mini-A plugterminal 51 is attached to the receptacle terminal 41, the control unit21 instructs the OTG unit 111 to supply a clock to the host unit 112,and starts the control of the communication apparatus 101 acting as theA-device. In the communication apparatus 102, which is a communicationpartner of the communication apparatus 101, the Mini-B plug terminal 52attached to the receptacle terminal 42 is detected, and the control unit22 starts the control to act as the B-device.

First, the control unit 21 obtains, in the course of enumerationprocessing, a descriptor from the communication apparatus 102 acting asthe device (step S21). The enumeration processing is a communicationprocedure defined in USB, which is executed when a host and a devicestart communication. In the enumeration processing, the host collectsvarious types of information concerning the device, and establishes aconnection with the device.

Then, the control unit 21 stores in the storage unit 31 variousdescriptors obtained by the communication processing unit 11 from thecommunication apparatus 102 in the enumeration processing (step S22).

The control unit 21 determines whether or not the descriptors obtainedfrom the communication partner include a predetermined descriptorincluding various types of information concerning the device (step S23).

The predetermined descriptor including various types of informationconcerning the device is hereinafter referred to as an “‘OTG DeviceStatus’ descriptor”. The ‘OTG Device Status’ descriptor storesinformation relating to the status of a communication apparatus at thetime when the enumeration processing is performed, etc. Thus, the ‘OTGDevice Status’ descriptor is not fixed information concerning thecommunication apparatus but is variable depending on the situation.

FIG. 11 shows an example of the data structure of the ‘OTG DeviceStatus’ descriptor. The ‘OTG Device Status’ descriptor shown in FIG. 11includes the following data fields: from the beginning, ‘descriptorlength’, ‘descriptor type’, ‘descriptor index’, ‘ready forcommunication’, ‘elapsed time (sec) since cable plugged in’, and‘elapsed time (sec) since last user operation’.

The ‘descriptor length’ field contains a total number of bytes of thedescriptor. The ‘descriptor type’ field contains an identifier foridentifying the descriptor. The ‘descriptor index’ field contains anindex if a plurality of descriptors exist.

The ‘ready for communication’ field is set to 1 if the communicationapparatus is available for communication at that time, or is set to 0otherwise. For example, if a USB cable is plugged in and enumerationprocessing starts when an application for file transfer is operating onthe communication apparatus, the communication apparatus is enabled toperform immediate communication, and this field is set to 1. If noapplication for USB transfer is in operation, on the other hand, thecommunication apparatus may not be available for communication, and thisfield is set to 0.

The ‘elapsed time (sec) since cable plugged in’ field contains anelapsed time (expressed in second) since a USB cable was plugged intothe communication apparatus until the enumeration processing isperformed to transfer an ‘OTG Device Status’ descriptor.

The ‘elapsed time (sec) from last user operation’ field contains anelapsed time (expressed in second) since the last time the user operatedthe communication apparatus until the enumeration processing isperformed to transfer an ‘OTG Device Status’ descriptor.

When such an ‘OTG Device Status’ descriptor is obtained from thecommunication partner (that is, the communication apparatus 102), thecontrol unit 21 refers to the obtained ‘OTG Device Status’ descriptor ofthe communication partner and the respective fields of an ‘OTG DeviceStatus’ descriptor in information concerning the communication apparatus101, which is detected by the control unit 21, to compare theoperability for the user between a case where the host/device roles havebeen switched and a case otherwise (step S24).

For example, in a case where a copy of data or the like is transferredbetween two communication apparatuses, in a situation where either ofthe apparatuses is available for a communication operation, a user mightpossibly desire to operate one of the apparatuses that has anapplication operating thereon for copying data. That is, higher userconvenience may be obtained by operating the apparatus having the ‘readyfor communication’ field set to 1. Thus, the apparatus having the ‘readyfor communication’ field set to 1 is designated as a host.

It is difficult for a user to plug the communication cable 50 into twocommunication apparatuses at the same time. The user generally connectsthe communication cable 50 to one of the communication apparatuses insequence. The later connected communication apparatus may possibly beheld with the user's hand or may possibly be near the user. Theoperation on the later connected communication apparatus would providehigher convenience due to reduced time spent on changing of theapparatuses, user's movement, or the like. That is, as a result ofcomparison of the ‘elapsed time (sec) since cable plugged in’ fieldbetween the connected communication apparatuses, higher user conveniencemay be obtained by operating the apparatus with less elapsed time. Thus,the apparatus having the ‘elapsed time (sec) since cable plugged in’field set to a smaller value is designated as a host.

Likewise, the communication apparatus that was operated by the userlater may possibly be held with the user's hand or may possibly be nearthe user. That is, as a result of comparison of the ‘elapsed time (sec)since last user operation’ field between the connected communicationapparatuses, higher user convenience may be obtained by operating theapparatus with less elapsed time. Thus, the apparatus with the ‘elapsedtime (sec) since last user operation’ field set to a smaller value isdesignated as a host.

Accordingly, the fields of the ‘OTG Device Status’ descriptors of thecommunication apparatuses 101 and 102 and information associatedtherewith are compared to determine whether or not to switch thehost/device roles.

The determination processing of step S24 will now be described withreference to a specific example of an ‘OTG Device Status’ descriptor.

FIG. 12 shows a specific example of an ‘OTG Device Status’ descriptor ofthe B-device (that is, the communication apparatus 102).

The A-device (that is, the communication apparatus 101), on the otherhand, has the ‘ready for communication’, ‘elapsed time (sec) since cableplugged in’, and ‘elapsed time (sec) since last user operation’ fieldsset to 0×0, 0×80, and 0×FF, respectively, by way of example.

For either of the communication apparatuses, a time of 255 seconds ormore has elapsed since the last user operation. However, since theB-device has been prepared for communication, the user may possiblydesire to operate the B-device. Further, since the B-device takes lesselapsed time since the communication cable 50 was plugged in, theB-device may possibly be near the user and it is therefore moreconvenient that the B-device be operated. As can be seen from the twoviewpoints described above, therefore, higher user convenience may beobtained by operating the B-device, and it may be determined that thehost/device roles are to be switched.

While simple examples have been described, a more complex situation mayoccur in actual use. For example, it may be determined higher userconvenience will be obtained by assigning a host to the A-device on thebasis of a certain field; whereas it may be determined that higher userconvenience will be obtained by assigning a host to the B-device on thebasis of another field. To address such a complex situation, prioritiesmay be allocated in advance to the individual fields to be used for thedetermination processing, or determination results for the respectivefields may be scored and the scores may be weighted and summed beforethe determination processing is performed.

As a result of comparison in user convenience between the A-device andthe B-device, if it is determined that the switching of the host/deviceroles would improve user convenience (Yes in step S24), the control unit21 controls the communication processing unit 11 to switch the operatingmodes between the communication apparatuses 101 and 102 by using HNP.More specifically, an acceptance of switching the host/device roles istransmitted to the device (step S25) before the host/device roles areactually switched (step S26). Thus, the host/device role switchingprocess ends, and the communication apparatuses 101 and 102 now act asthe device and the host, respectively, and perform their communicationoperations.

As a result of comparison in user convenience between the A-device andthe B-device, if it is determined that the switching of the host/deviceroles would not improve user convenience (No in step S24), theprocessing routine ends, and the communication apparatuses 101 and 102still act as the host and the device, respectively, and perform theircommunication operations.

A communication procedure performed by the communication apparatus 101acting as the A-device with respect to the communication apparatus 102acting as the B-device according to the operating procedure shown inFIG. 10 is similar to that of the first embodiment, except for thedescriptor used therefor and its accompanying method of determiningwhether or not to switch the host/device roles, and will not bediscussed herein.

In the second embodiment, therefore, the communication apparatus 101 or102, when initially acting as a host, obtains a descriptor from thecommunication partner acting as a device under control of the controlunit 21 or 22, the descriptor containing information relating to theindividual use conditions of the apparatuses or the statuses of theapparatuses, etc. The control unit 21 or 22 refers to the obtaineddescriptor of the communication partner and the descriptor detectedtherein to determine whether or not the switching of the host/deviceroles would improve user convenience. If it is determined that theswitching of the host/device roles would improve user convenience, thecommunication partner is notified of an acceptance of switching thehost/device roles by using HNP according to an instruction given by thecontrol unit 21 or 22, and the host/device roles are switched by usingHNP.

With the operation described above, even if a communication apparatusthat is not desired by a user is set to be operated in an initial statewhere the communication cable 50 is connected, the host/device roles areautomatically switched to allow the user to reduce the time spent onchanging of the apparatuses or movement.

Since the operating procedure for obtaining information concerning thecommunication partner and switching the host/device roles is performedusing a method complying with the USB 2.0 and OTG standards, the secondembodiment can be readily applied to devices compatible with thosestandards.

Further, the processing for switching the host/device roles, describedabove, is executed primarily by the control units 21 and 22. This meansthat the processing can be implemented by a computer. Thus, an existingcommunication apparatus whose overall operations involving communicationprocessing are controlled by a computer can also implement the functionsof the second embodiment by modifying a program without speciallychanging the hardware configuration thereof.

While specific embodiments of the present invention have been describedin detail, it is to be understood that a person skilled in the art couldmake modifications or alterations to the embodiments without departingfrom the scope of the present invention.

While several preferred embodiments of the present invention have beendiscussed herein, embodiments of the present invention are not limitedto those embodiments, and other variations may be made thereto.

For example, other embodiments may be conceived for the structure of acommunication apparatus, an operation of switching the host/device rolesby using HNP, the content of the descriptors, etc. Further, theillustrated flowcharts and communication procedures are merelyillustrative and may be suitably modified or changed for implementation.

In either of the foregoing embodiments, it is determined whether or notto switch the operating modes on the basis of information of adescriptor obtained during the enumeration processing. Alternatively,this information may be obtained via communication based on a devicerequest or the like after the enumeration processing.

In USB, the host takes the initiative to utilize various functions orinitiate data transmission. It can therefore be necessary to determinewhether or not to switch the host/device roles by taking user'spreferences into account. In an embodiment of the present invention,therefore, an acknowledgement may be received from a user via apredetermined user interface device before the host/device roles areswitched.

For example, when the conditions for switching the host/device roles,described above, are established, a control unit may request a user toconfirm whether or not to switch the operating modes through a userinterface device. When a response of acceptance of the confirmationrequest is entered through the user interface device, the host/deviceroles may be switched.

Furthermore, at least some of the components of the communicationapparatuses described in the specification and illustrated in thedrawings may be implemented by cooperation of a computer and a softwareprogram or by a combination of software and hardware, or all thecomponents may be implemented by hardware.

While the foregoing embodiments have been described herein in thecontext of a communication system complying with the OTG standard, whichis a supplement to the USB 2.0 standard, embodiments of the presentinvention are not limited to those embodiments. Some embodiments of thepresent invention may provide various communication interfaces orcommunication protocols that allow one of devices that has a host roleover a communication interface to control the data transmissionoperation of other devices acting as devices and that allow at leastsome of devices to have both host and device roles.

While the foregoing embodiments have been described herein in thecontext of a connection between communication apparatuses capable offulfilling both host and device roles via a USB cable, embodiments ofthe present invention are not limited to a specific communicationmedium. For example, an embodiment of the present invention may providea communication interface composed of a wireless interface such as aWUSB interface.

Therefore, the foregoing embodiments of the present invention aredisclosed herein for illustrative purposes only, and are not intended tolimit the scope of the disclosure. Those skilled in the art willappreciate the scope and spirit of the present invention with referenceto the appended claims.

It should be understood by those skilled in the art that variousmodifications, combinations, sub-combinations and alterations may occurdepending on design requirements and other factors insofar as they arewithin the scope of the appended claims or the equivalents thereof.

1. A communication system comprising: a plurality of communicationapparatuses configured to perform data transmission over a predeterminedcommunication interface that allows one of the communication apparatusesto act as a host and to control data transmission and that allows theother communication apparatuses to act as devices and to perform datatransmission under control of the host, the plurality of communicationapparatuses including a first communication apparatus and a secondcommunication apparatus, the first communication apparatus and thesecond communication apparatus being connected to the predeterminedcommunication interface, each of the first communication apparatus andthe and second communication apparatus having both host and deviceroles, the first communication apparatus and the second communicationapparatus being configured to exchange the host and device roles byusing a predetermined communication protocol, the first communicationapparatus being designated as the host and the second communicationapparatus being designated as one of the devices; apparatus-informationtransmitting means for transmitting apparatus information relating to astructure or specific information of the second communication apparatusto the first communication apparatus; determining means for determiningwhether or not to switch the host and device roles between the firstcommunication apparatus and the second communication apparatus accordingto a predetermined criterion when the first communication apparatuscompares the apparatus information transmitted by the secondcommunication apparatus with apparatus information relating to astructure or specific information of the first communication apparatus;and switching procedure executing means for executing a procedure forswitching the host and device roles between the first communicationapparatus and the second communication apparatus by using thepredetermined communication protocol when an affirmative determinationresult is obtained from the determining means.
 2. A communicationapparatus for performing a communication operation over a predeterminedcommunication interface that allows one of a plurality of communicationapparatuses to act as a host and to control data transmission and thatallows the other communication apparatuses to act as devices and toperform data transmission under control of the host, the communicationapparatus having both host and device roles, the predeterminedcommunication interface being specified by a predetermined communicationprotocol for switching the host and device roles between thecommunication apparatuses, the communication apparatus comprising:switching procedure executing means for executing a procedure forswitching the host and device roles by using the predeterminedcommunication protocol; apparatus-information transmitting means fortransmitting, when the communication apparatus is designated as thedevice, apparatus information relating to a structure or specificinformation of the communication apparatus to a communication apparatusacting as the host over the predetermined communication interface;apparatus-information receiving means for receiving, when thecommunication apparatus is designated as the host, the apparatusinformation from a second communication apparatus acting as the deviceover the predetermined communication interface; and determining meansfor comparing, when the communication apparatus is designated as thehost, the apparatus information transmitted by the second communicationapparatus with the apparatus information relating to a structure orspecific information of the communication apparatus to determine whetheror not to switch the host and device roles between the communicationapparatus and the second communication apparatus according to apredetermined criterion, wherein the switching procedure executing meansexecutes the procedure for switching the host and device roles betweenthe communication apparatus and the second communication apparatus whenan affirmative determination result is obtained from the determiningmeans.
 3. The communication apparatus according to claim 2, wherein thepredetermined communication interface includes a Universal Serial Businterface, and the predetermined protocol includes Host NegotiationProtocol defined in Universal Serial Bus On-The-Go.
 4. The communicationapparatus according to claim 2, wherein the apparatus informationtransmitted by the apparatus information transmitting means includeshardware version information or software version information of thecommunication apparatus.
 5. The communication apparatus according toclaim 2, wherein the apparatus information transmitted by the apparatusinformation transmitting means includes information relating to anoutput device or input device included in the communication apparatus.6. The communication apparatus according to claim 2, wherein thepredetermined criterion is based on an improvement in user operabilityor an improvement in user convenience, and the determining meansdetermines whether or not to switch the host and device roles withrespect to the second communication apparatus according to thepredetermined criterion.
 7. A method for controlling a communicationapparatus for performing a communication operation over a predeterminedcommunication interface that allows one of a plurality of communicationapparatuses to act as a host and to control data transmission and thatallows the other communication apparatuses to act as devices and toperform data transmission under control of the host, the communicationapparatus having both host and device roles, the predeterminedcommunication interface being specified by a predetermined communicationprotocol for switching the host and device roles between thecommunication apparatuses, the method comprising the steps of:transmitting, when the communication apparatus is designated as thedevice, apparatus information relating to a structure or specificinformation of the communication apparatus to a communication apparatusacting as the host over the predetermined communication interface;receiving, when the communication apparatus is designated as the host,the apparatus information from a second communication apparatus actingas the device over the predetermined communication interface; comparing,when the communication apparatus is designated as the host, theapparatus information transmitted by the second communication apparatuswith the apparatus information relating to a structure or specificinformation of the communication apparatus to determine whether or notto switch the host and device roles between the communication apparatusand the second communication apparatus according to a predeterminedcriterion; and executing, when an affirmative determination result isobtained, a procedure for switching the host and device roles betweenthe communication apparatus and the second communication apparatus bysuing the predetermined communication protocol.
 8. A computer-readablecomputer program for performing control of a communication apparatus ona computer, the communication apparatus being configured to perform acommunication operation over a predetermined communication interfacethat allows one of a plurality of communication apparatuses to act as ahost and to control data transmission and that allows the othercommunication apparatuses to act as devices and to perform datatransmission under control of the host, the communication apparatushaving both host and device roles, the predetermined communicationinterface being specified by a predetermined communication protocol forswitching the host and device roles between the communicationapparatuses, the computer program causing the computer to execute thesteps of: transmitting, when the communication apparatus is designatedas the device, apparatus information relating to a structure or specificinformation of the communication apparatus to a communication apparatusacting as the host over the predetermined communication interface;receiving, when the communication apparatus is designated as the host,the apparatus information from a second communication apparatus actingas the device over the predetermined communication interface; comparing,when the communication apparatus is designated as the host, theapparatus information transmitted by the second communication apparatuswith the apparatus information relating to a structure or specificinformation of the communication apparatus to determine whether or notto switch the host and device roles between the communication apparatusand the second communication apparatus according to a predeterminedcriterion; and executing, when an affirmative determination result isobtained, a procedure for switching the host and device roles betweenthe communication apparatus and the second communication apparatus bysuing the predetermined communication protocol.
 9. A communicationsystem comprising: a plurality of communication apparatuses configuredto perform data transmission over a predetermined communicationinterface that allows which one of the communication apparatuses to actas a host and to control data transmission and that allows the othercommunication apparatuses to act as devices and to perform datatransmission under control of the host, the plurality of communicationapparatuses including a first communication apparatus and a secondcommunication apparatus, the first communication apparatus and thesecond communication apparatus being connected to the predeterminedcommunication interface, each of the first communication apparatus andthe second communication apparatus having both host and device roles,the first communication apparatus and the second communication apparatusbeing configured to exchange the host and device roles by using apredetermined communication protocol, the first communication apparatusbeing designated as the host and the second communication apparatusbeing designated as the device; apparatus-status-informationtransmitting means for transmitting apparatus-status informationrelating to a status of the second communication apparatus to the firstcommunication apparatus; determining means for determining whether ornot to switch the host and device roles between the first communicationapparatus and the second communication apparatus according to apredetermined criterion when the first communication apparatus comparesthe apparatus-status information transmitted by the second communicationapparatus with apparatus-status information relating to a status of thefirst communication apparatus; and switching procedure executing meansfor executing a procedure for switching the host and device rolesbetween the first communication apparatus and the second communicationapparatus by using the predetermined communication protocol when anaffirmative determination result is obtained from the determining means.10. A communication apparatus for performing a communication operationover a predetermined communication interface that allows one of aplurality of communication apparatuses to act as a host and to controldata transmission and that allows the other communication apparatuses toact as devices and to perform data transmission under control of thehost, the communication apparatus having both host and device roles, thepredetermined communication interface being specified by a predeterminedcommunication protocol for switching the host and device roles betweenthe communication apparatuses, the communication apparatus comprising:switching procedure executing means for executing a procedure forswitching the host and device roles by using the predeterminedcommunication protocol; apparatus-status-information transmitting meansfor transmitting, when the communication apparatus is designated as thedevice, apparatus-status information relating to a status of thecommunication apparatus to a communication apparatus acting as the hostover the predetermined communication interface; apparatus-statusinformation receiving means for receiving, when the communicationapparatus is designated as the host, the apparatus-status informationfrom a second communication apparatus acting as the device over thepredetermined communication interface; and determining means forcomparing, when the communication apparatus is designated as the host,the apparatus-status information transmitted by the second communicationapparatus with apparatus-status information relating to a status of thecommunication apparatus to determine whether or not to switch the hostand device roles between the communication apparatus and the secondcommunication apparatus according to a predetermined criterion, whereinthe switching procedure executing means executes the procedure forswitching the host and device roles between the communication apparatusand the second communication apparatus when an affirmative determinationresult is obtained from the determining means.
 11. The communicationapparatus according to claim 10, wherein the predetermined communicationinterface includes a Universal Serial Bus interface, and thepredetermined protocol includes Host Negotiation Protocol defined inUniversal Serial Bus On-The-Go.
 12. The communication apparatusaccording to claim 10, wherein the apparatus-status informationtransmitted by the apparatus-status-information transmitting meansincludes information indicating whether or not the communicationapparatus is ready to perform communication.
 13. The communicationapparatus according to claim 10, wherein the apparatus-statusinformation transmitted by the apparatus-status-information transmittingmeans includes a status of an application operating on the communicationapparatus.
 14. The communication apparatus according to claim 10,wherein the apparatus-status information transmitted by theapparatus-status-information transmitting means includes informationrelating to a time that has elapsed since the communication apparatuswas connected to the predetermined communication interface.
 15. Thecommunication apparatus according to claim 10, wherein theapparatus-status information transmitted by theapparatus-status-information transmitting means includes informationrelating to a time that has elapsed since the last time a user operatedthe communication apparatus.
 16. The communication apparatus accordingto claim 10, wherein the predetermined criterion is based on animprovement in user operability or an improvement in user convenience,and the determining means determines whether or not to switch the hostand device roles between the second communication apparatus according tothe predetermined criterion.
 17. A method for controlling acommunication apparatus for performing a communication operation over apredetermined communication interface that allows one of a plurality ofcommunication apparatuses to act as a host and to control datatransmission and that allows the other communication apparatuses to actas devices and to perform data transmission under control of the host,the communication apparatus having both host and device roles, thepredetermined communication interface being specified by a predeterminedcommunication protocol for switching the host and device roles betweenthe communication apparatuses, the method comprising the steps of:transmitting, when the communication apparatus is designated as thedevice, apparatus-status information relating to a status of thecommunication apparatus to a communication apparatus acting as the hostover the predetermined communication interface; receiving, when thecommunication apparatus is designated as the host, the apparatus-statusinformation from a second communication apparatus acting as the deviceover the predetermined communication interface; comparing, when thecommunication apparatus is designated as the host, the apparatus-statusinformation transmitted by the second communication apparatus withapparatus-status information relating to a status of the communicationapparatus to determine whether or not to switch the host and deviceroles between the communication apparatus and the second communicationapparatus according to a predetermined criterion; and executing, when anaffirmative determination result is obtained, a procedure for switchingthe host and device roles between the communication apparatus and thesecond communication apparatus by suing the predetermined communicationprotocol.
 18. A computer-readable computer program for performingcontrol of a communication apparatus on a computer, the communicationapparatus being configured to perform a communication operation over apredetermined communication interface that allows one of a plurality ofcommunication apparatuses to act as a host and to control datatransmission and that allows the other communication apparatuses to actas devices and to perform data transmission under control of the host,the communication apparatus having both host and device roles, thepredetermined communication interface being specified by a predeterminedcommunication protocol for switching the host and device roles betweenthe communication apparatuses, the computer program causing the computerto execute the steps of: transmitting, when the communication apparatusis designated as the device, apparatus-status information relating to astatus of the communication apparatus to a communication apparatusacting as the host over the predetermined communication interface;receiving, when the communication apparatus is designated as the host,the apparatus-status information from a second communication apparatusacting as the device over the predetermined communication interface;comparing, when the communication apparatus is designated as the host,the apparatus-status information transmitted by the second communicationapparatus with apparatus-status information relating to a status of thecommunication apparatus to determine whether or not to switch the hostand device roles between the communication apparatus and the secondcommunication apparatus according to a predetermined criterion; andexecuting, when an affirmative determination result is obtained, aprocedure for switching the host and device roles between thecommunication apparatus and the second communication apparatus by suingthe predetermined communication protocol.
 19. A communication systemcomprising: a plurality of communication apparatuses configured toperform data transmission over a predetermined communication interfacethat allows one of the communication apparatuses to act as a host and tocontrol data transmission and that allows the other communicationapparatuses to act as devices and to perform data transmission undercontrol of the host, the plurality of communication apparatusesincluding a first communication apparatus and a second communicationapparatus, the first communication apparatus and the secondcommunication apparatus being connected to the predeterminedcommunication interface, each of the first communication apparatus andthe and second communication apparatus having both host and deviceroles, the first communication apparatus and the second communicationapparatus being configured to exchange the host and device roles byusing a predetermined communication protocol, the first communicationapparatus being designated as the host and the second communicationapparatus being designated as one of the devices; anapparatus-information transmitting unit configured to transmit apparatusinformation relating to a structure or specific information of thesecond communication apparatus to the first communication apparatus; adetermining unit configured to determine whether or not to switch thehost and device roles between the first communication apparatus and thesecond communication apparatus according to a predetermined criterionwhen the first communication apparatus compares the apparatusinformation transmitted by the second communication apparatus withapparatus information relating to a structure or specific information ofthe first communication apparatus; and a switching procedure executingunit configured to execute a procedure for switching the host and deviceroles between the first communication apparatus and the secondcommunication apparatus by using the predetermined communicationprotocol when an affirmative determination result is obtained from thedetermining unit.
 20. A communication apparatus for performing acommunication operation over a predetermined communication interfacethat allows one of a plurality of communication apparatuses to act as ahost and to control data transmission and that allows the othercommunication apparatuses to act as devices and to perform datatransmission under control of the host, the communication apparatushaving both host and device roles, the predetermined communicationinterface being specified by a predetermined communication protocol forswitching the host and device roles between the communicationapparatuses, the communication apparatus comprising: a switchingprocedure executing unit configured to execute a procedure for switchingthe host and device roles by using the predetermined communicationprotocol; an apparatus-information transmitting unit configured totransmit, when the communication apparatus is designated as the device,apparatus information relating to a structure or specific information ofthe communication apparatus to a communication apparatus acting as thehost over the predetermined communication interface; anapparatus-information receiving unit configured to receive, when thecommunication apparatus is designated as the host, the apparatusinformation from a second communication apparatus acting as the deviceover the predetermined communication interface; and a determining unitconfigured to compare, when the communication apparatus is designated asthe host, the apparatus information transmitted by the secondcommunication apparatus with the apparatus information relating to astructure or specific information of the communication apparatus todetermine whether or not to switch the host and device roles between thecommunication apparatus and the second communication apparatus accordingto a predetermined criterion, wherein the switching procedure executingunit executes the procedure for switching the host and device rolesbetween the communication apparatus and the second communicationapparatus when an affirmative determination result is obtained from thedetermining unit.
 21. A communication system comprising: a plurality ofcommunication apparatuses configured to perform data transmission over apredetermined communication interface that allows which one of thecommunication apparatuses to act as a host and to control datatransmission and that allows the other communication apparatuses to actas devices and to perform data transmission under control of the host,the plurality of communication apparatuses including a firstcommunication apparatus and a second communication apparatus, the firstcommunication apparatus and the second communication apparatus beingconnected to the predetermined communication interface, each of thefirst communication apparatus and the second communication apparatushaving both host and device roles, the first communication apparatus andthe second communication apparatus being configured to exchange the hostand device roles by using a predetermined communication protocol, thefirst communication apparatus being designated as the host and thesecond communication apparatus being designated as the device; anapparatus-status-information transmitting unit configured to transmitapparatus-status information relating to a status of the secondcommunication apparatus to the first communication apparatus; adetermining unit configured to determine whether or not to switch thehost and device roles between the first communication apparatus and thesecond communication apparatus according to a predetermined criterionwhen the first communication apparatus compares the apparatus-statusinformation transmitted by the second communication apparatus withapparatus-status information relating to a status of the firstcommunication apparatus; and a switching procedure executing unitconfigured to execute a procedure for switching the host and deviceroles between the first communication apparatus and the secondcommunication apparatus by using the predetermined communicationprotocol when an affirmative determination result is obtained from thedetermining unit.
 22. A communication apparatus for performing acommunication operation over a predetermined communication interfacethat allows one of a plurality of communication apparatuses to act as ahost and to control data transmission and that allows the othercommunication apparatuses to act as devices and to perform datatransmission under control of the host, the communication apparatushaving both host and device roles, the predetermined communicationinterface being specified by a predetermined communication protocol forswitching the host and device roles between the communicationapparatuses, the communication apparatus comprising: a switchingprocedure executing unit configured to execute a procedure for switchingthe host and device roles by using the predetermined communicationprotocol; an apparatus-status-information transmitting unit configuredto transmit, when the communication apparatus is designated as thedevice, apparatus-status information relating to a status of thecommunication apparatus to a communication apparatus acting as the hostover the predetermined communication interface; an apparatus-statusinformation receiving unit configured to receive, when the communicationapparatus is designated as the host, the apparatus-status informationfrom a second communication apparatus acting as the device over thepredetermined communication interface; and a determining unit configuredto compare, when the communication apparatus is designated as the host,the apparatus-status information transmitted by the second communicationapparatus with apparatus-status information relating to a status of thecommunication apparatus to determine whether or not to switch the hostand device roles between the communication apparatus and the secondcommunication apparatus according to a predetermined criterion, whereinthe switching procedure executing unit executes the procedure forswitching the host and device roles between the communication apparatusand the second communication apparatus when an affirmative determinationresult is obtained from the determining unit.